<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2017/11/13
 * Time: 16:57
 * used to study middleware
 */

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use Illuminate\Support\Facades\Crypt;
use Illuminate\Support\Str;
use Laravel\Lumen\Routing\Controller as BaseController;

class UserController extends BaseController
{
    // login
    public function login(){
        echo "login page";
    }

    public function index(){
        echo "hello world";
    }

    // encrypt
    public function encrypt(Request $request){
        $str = "299792";
        $result = Crypt::encrypt($str);
        return redirect()->route('crypt',['str'=>$result]);
    }

    // crypt
    public function crypt(Request $request){
        $str = $request->get('str');
        $result = Crypt::decrypt($str);
        echo $result;
    }
}